﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserPwdSetting.aspx.cs"
    Inherits="ZX.WebApp.EditWidows.SysManager.UserPwdSetting" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../Scripts/yui_2.9.0/build/reset-fonts-grids/reset-fonts-grids.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/yui_2.9.0/build/menu/assets/skins/sam/menu.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/yui_2.9.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />
    <link type="text/css" rel="stylesheet" href="../../Scripts/yui_2.9.0/build/datatable/assets/skins/sam/datatable.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/yui_2.9.0/build/fonts/fonts-min.css" />
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/container/container-min.js"></script>
</head>
<body class="yui-skin-sam">
    <form id="form1" runat="server">
    <table align="center" style="width: 250px; height: 100%">
        <tr style="height: 30px;">
            <td colspan="2">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="right" style="height: 30px">
                新密码
            </td>
            <td>
                <input type="password" id="newPwd" style="height:20px;" />
            </td>
        </tr>
        <tr>
            <td align="right" style="height: 30px">
                确认新密码
            </td>
            <td>
                <input type="password" id="rNewPwd" style="height:20px;" />
            </td>
        </tr>
    </table>
    </form>
</body>
<script type="text/javascript">
    function Save() {
        var flag = true;
        if (document.getElementById("newPwd").value == "") {
            alert("新密码不能为空!");
            document.getElementById("newPwd").focus();
            flag = false;
        } else if (document.getElementById("rNewPwd").value == "") {
            alert("确认新密码不能为空!");
            document.getElementById("rNewPwd").focus();
            flag = false;
        } else if (document.getElementById("newPwd").value != document.getElementById("rNewPwd").value) {
            alert("两次输入密码不一致!");
            document.getElementById("newPwd").value = "";
            document.getElementById("rNewPwd").value = "";
            document.getElementById("newPwd").focus();
            flag = false;
        }
        if (flag) {
            var news = document.getElementById("rNewPwd").value;
            var url = "../../Extend/AjaxData/DataProcessin.aspx?action=Update&entity=DatUser&ids=<%=UserIds %>&news=" + news + "";
            YAHOO.util.Connect.asyncRequest('POST', url, {
                success: function (res) {
                    var inventory;
                    try {
                        inventory = res.responseText;
                        if (inventory == "1") {
                            alert("修改密码成功!");
                            parent.closeWin();
                        } else {
                            alert("修改密码失败!");
                        }
                    }
                    catch (e) {
                    }
                    finally {
                    }
                },
                failure: function (error) {
                    alert("读取菜单数据错误：" + error.statusText);
                }
            }, null);
        }
    }
</script>
</html>
